package com.tledu.course.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.tledu.course.mapper.SonSectionMapper;
import com.tledu.course.domain.SonSection;
import com.tledu.course.service.ISonSectionService;
import com.ruoyi.common.core.text.Convert;

/**
 * 子章节Service业务层处理
 * 
 * @author Ghost
 * @date 2021-07-13
 */
@Service
public class SonSectionServiceImpl implements ISonSectionService 
{
    @Autowired
    private SonSectionMapper sonSectionMapper;

    /**
     * 查询子章节
     * 
     * @param sonSectionId 子章节ID
     * @return 子章节
     */
    @Override
    public SonSection selectSonSectionById(Integer sonSectionId)
    {
        return sonSectionMapper.selectSonSectionById(sonSectionId);
    }

    /**
     * 查询子章节列表
     * 
     * @param sonSection 子章节
     * @return 子章节
     */
    @Override
    public List<SonSection> selectSonSectionList(SonSection sonSection)
    {
        return sonSectionMapper.selectSonSectionList(sonSection);
    }

    /**
     * 新增子章节
     * 
     * @param sonSection 子章节
     * @return 结果
     */
    @Override
    public int insertSonSection(SonSection sonSection)
    {
        sonSection.setCreateTime(DateUtils.getNowDate());
        return sonSectionMapper.insertSonSection(sonSection);
    }

    /**
     * 修改子章节
     * 
     * @param sonSection 子章节
     * @return 结果
     */
    @Override
    public int updateSonSection(SonSection sonSection)
    {
        sonSection.setUpdateTime(DateUtils.getNowDate());
        return sonSectionMapper.updateSonSection(sonSection);
    }

    /**
     * 删除子章节对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteSonSectionByIds(String ids)
    {
        return sonSectionMapper.deleteSonSectionByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除子章节信息
     * 
     * @param sonSectionId 子章节ID
     * @return 结果
     */
    @Override
    public int deleteSonSectionById(Integer sonSectionId)
    {
        return sonSectionMapper.deleteSonSectionById(sonSectionId);
    }
}
